@extends('layouts.default') 
@section('main')
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <link rel="stylesheet" href="/css/chosen.css" />
    <script type="text/javascript" src="/js/chosen.jquery.min.js"></script>
    <link rel="stylesheet" href="{{URL::asset('js/')}}/kindeditor-4.1.7/themes/default/default.css" />
    <link rel="stylesheet" href="{{URL::asset('js/')}}/kindeditor-4.1.7/plugins/code/prettify.css" />
    <script src="{{URL::asset('js/')}}/kindeditor-4.1.7/kindeditor.js" type="text/javascript"></script> 
    <script charset="utf-8" src="{{URL::asset('js/')}}/kindeditor-4.1.7/lang/zh_CN.js"></script> 
    <script charset="utf-8" src="{{URL::asset('js/')}}/kindeditor-4.1.7/plugins/code/prettify.js"></script>
    <script type="text/javascript" src="{{URL::asset('js/')}}/ajaxfileupload.js"></script>
    <script type="text/javascript" src="{{URL::asset('js/')}}/common.js"></script>
    <script src="{{URL::asset('js/My97DatePicker/')}}/WdatePicker.js"></script> 
    <script>
    KindEditor.ready(function(K) {
            var editor1 = K.create('#project_content,#project_invest_aim,#project_fund_plan,#project_team_advantage,#project_invest_aim', {
                uploadJson: "{{url('kindedit/upload')}}",
                fileManagerJson: "{{url('kindedit/manager')}}",
                allowFileManager: true,
                afterBlur: function() {
                    this.sync();
                },
                items: ['source', '|', 'undo', 'redo', '|', 'cut', 'copy', 'paste', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript', 'superscript', 'clearhtml', 'quickformat', 'selectall', 'image', '/', 'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'table', 'hr', 'emoticons', 'pagebreak', 'anchor', 'link', 'unlink', '|']
            });

    });
    </script>
    <div id="content">
        <div id="content-header">
            <div id="breadcrumb">
                <a href="{{url('home')}}" title="返回首页" class="tip-bottom"><i
                            class="icon-home"></i> 首页</a> <a href="{{url('project/index')}}" class="tip-bottom">项目管理</a> <a href="#" class="current">项目信息修改</a>
            </div>
        </div>
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span7" style="width:80%;">
                    <div class="widget-box">
                        <div class="widget-title">
						<span class="icon"> <i class="icon-align-justify"></i>
						</span>
                            <h5>基础信息</h5>
                        </div>
                        <div class="widget-content nopadding">
                            <form  action="{{url('project/update')}}" method="post" class="form-horizontal" id="projectForm" >
                                <div class="control-group">
                                    <label class="control-label">项目ID :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="id" value="{{$project->id}}" readonly="readonly" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>项目名称 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="subject" value="{{$project->subject}}"   />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">副标题 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="title" value="{{$project->title}}"  />
                                    </div>
                                </div>


                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>项目类型 :</label>
                                    <div class="controls">
                                        <select name="type" id="type" >
                                            <option value="">请选择</option>
                                            <option value="chuangye" @if($project->type == 'chuangye') selected @endif >创业</option>
                                            <option value="newthree" @if($project->type == 'newthree') selected @endif >新三板</option>
                                        </select>
                                    </div>
                                </div>

                                <div class="control-group" id="project_period">
                                    <label class="control-label">项目阶段 :</label>
                                    <div class="controls">
                                        <select name="project_period" >
                                            <option value="">请选择</option>
                                            @foreach( $project_period as $key => $v )
                                                <option value="{{ $v->code }}" @if($project->project_period==$v->code)selected="selected" @endif>{{ $v->name}}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>

                                <div class="control-group" style="display: none;" id="newthree_period">
                                    <label class="control-label"><span class="redD">*</span>项目阶段(新三板) :</label>
                                    <div class="controls">
                                        <select name="newthree_period" >
                                            <option value="">请选择</option>
                                            <option value="niguapai" @if($project->newthree_period == 'niguapai') selected @endif >拟挂牌</option>
                                            <option value="yiguapai" @if($project->newthree_period == 'yiguapai') selected @endif >已挂牌</option>
                                        </select>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">融资阶段 :</label>
                                    <div class="controls">
                                        <select name="invest_period" >
                                            <option value="">请选择</option>
                                            @foreach( $invest_period as $key => $v )
                                                <option value="{{ $v->code }}" @if($project->invest_period==$v->code)selected="selected" @endif>{{ $v->name}}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>

                                
                                <div class="control-group" id="invest_way">
                                    <label class="control-label"><span class="redD">*</span>融资方式 :</label>
                                    <div class="controls">
                                        <label> <input type="checkbox" name="invest_way[]" value="1" <?php if(in_array(1, explode(',',$project->invest_way))) echo 'checked="checked"'; ?> /> 股权融资
                                        </label> <label> <input type="checkbox" name="invest_way[]" value="2" <?php if(in_array(2, explode(',',$project->invest_way))) echo 'checked="checked"'; ?> /> 债券融资
                                        </label><label> <input type="checkbox" name="invest_way[]" value="3" <?php if(in_array(3, explode(',',$project->invest_way))) echo 'checked="checked"'; ?> /> 融资租赁
                                        </label>
                                    </div>
                                </div>

                                <div class="control-group" id="newthree_invest_way" style="display: none;" >
                                    <label class="control-label"><span class="redD">*</span>融资方式(新三板) :</label>
                                    <div class="controls">
                                        <select name="newthree_invest_way" >
                                            <option value="">请选择</option>
                                            <option value="xinsanbanjijin" @if($project->newthree_invest_way == 'xinsanbanjijin') selected @endif >新三板基金</option>
                                            <option value="dingxiangzengfa" @if($project->newthree_invest_way == 'dingxiangzengfa') selected @endif >定向增发</option>
                                            <option value="xingourengou" @if($project->newthree_invest_way == 'xingourengou') selected @endif >新股认购</option>
                                        </select>
                                    </div>
                                </div>


                                <div class="control-group" id="out" style="display: none;" >
                                    <label class="control-label"><span class="redD">*</span>退出机制 :</label>
                                    <div class="controls">
                                        <label> <input type="checkbox" name="out[]" value="pinggou" @if(in_array('pinggou',explode(',',$project->out))) checked="checked" @endif />并购退出</label>
                                        <label> <input type="checkbox" name="out[]" value="ipo" @if(in_array('ipo',explode(',',$project->out))) checked="checked" @endif />IPO退出</label>
                                        <label> <input type="checkbox" name="out[]" value="zuoshi" @if(in_array('zuoshi',explode(',',$project->out))) checked="checked" @endif />做市交易</label>
                                        <label> <input type="checkbox" name="out[]" value="huigou" @if(in_array('huigou',explode(',',$project->out))) checked="checked" @endif />大股东回购</label>
                                    </div>
                                </div>


                                <div class="control-group">
                                    <label class="control-label">融资目的 :</label>
                                    <div class="controls">
                                        <textarea id="project_invest_aim" name="invest_aim" style="width: 450px; height: 240px;"><?php echo htmlspecialchars_decode($project->invest_aim); ?></textarea>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>行业分类 :</label>
                                    <div class="controls">
                                        @foreach($categories as $key => $category)
                                            <input type="checkbox" name="categories[]" value="{{ $key }}"<?php foreach ($project_categories as $project_category) {
                                                if($project_category == $key) echo 'checked="checked"';}
                                            ?>>&nbsp{{$category}}
                                            
                                        @endforeach
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">项目简介 :</label>
                                    <div class="controls">
                                        <textarea id="description" name="description" cols="150" rows="6" style="width:650px;">{{$project->description}}</textarea>
                                    </div>
                                </div>
                                
                                <div class="control-group">
                                    <label class="control-label">内容 :</label>
                                    <div class="controls">
                                        <textarea id="project_content" name="content" style="width: 450px; height: 240px;"><?php echo htmlspecialchars_decode($project->content); ?></textarea>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">列表页底图 :</label>
                                    <div class="controls">
                                        <input type="hidden" class="span11" name="photo"
                                            placeholder="图片" value="{{$project->photo}}" />
                                        <img src="{{getImage($project->photo)}}" width="120px" name="photo" height="120px"/>

                                        <a href="javascript:void(0);" id="uploadPhotoBtn"  onclick="javascript:openBrowse('uploadPhotoBtn','uploadPhoto');">点击上传(图片大小不少于h:285像素×w:150像素)</a>
                                            <input type="file" id="uploadPhoto" name="myfile" style="display:none"  size="10" onchange="fileUpload('uploadPhoto','photo')"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">详情页logo :</label>
                                    <div class="controls">
                                        <input type="hidden" class="span11" name="big_image"
                                               placeholder="点击右边小图标上传推广大图" value="{{$project->big_image}}" />
                                        <img src="{{getImage($project->big_image)}}" width="120px" name="big_image" height="120px"/>

                                        <a href="javascript:void(0);" id="uploadBimgBtn"   onclick="javascript:openBrowse('uploadBimgBtn','uploadBimg');">点击上传(图片大小不少于h:400像素×w:400像素)</a>
                                        <input type="file" id="uploadBimg" style="display:none" name="myfile" size="10" onchange="fileUpload('uploadBimg','big_image')"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>所在地区 :</label>
                                    <div class="controls">
                                        <select name="city_id" id="city">
                                        <option value="0">省份</option>
                                            @foreach($zoneTree as $zone)
                                                <option value="{{$zone['id']}}" @if(isset($family[1]) && $family[1]['id'] == $zone['id']) selected="selected" @endif>{{$zone['name']}}</option>
                                            @endforeach
                                        </select>
                                        <select name="zone_id" id="zone">
                                            <option value="@if(isset($family[0])){{$family[0]['id']}}@endif">@if(isset($family[0])){{$family[0]['name']}}@else城市@endif</option>
                                        </select>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">发布时间 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="pubdate" value="<?php echo date('Y-m-d H:i:s',$project->pubdate); ?>" placeholder="发布时间" onfocus="WdatePicker({startDate:'<?php echo date('Y-m-d H:i:s',$project->pubdate); ?>',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})"  />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">用户姓名或手机号的一部分供模糊搜索 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="user_search" value="" placeholder="输入用户姓名或手机号的一部分，按下Enter键，搜索结果将出现在下面的多选框中，供选择" />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>项目拥有人 :</label>
                                    <div class="controls">
                                        <select name="uid" id="uid">
                                            @foreach( $users as $key => $user )
                                                <option value="{{$user->uid}}" @if($user->uid== $project->uid) selected="selected"@endif >{{ $user->realname or $user->nickname }}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">项目开始时间 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="start_time" value="<?php echo date('Y-m-d H:i:s',$project->start_time); ?>" placeholder="项目开始时间" onfocus="WdatePicker({startDate:'<?php echo date('Y-m-d H:i:s',$project->start_time); ?>',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})"  />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">排序 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="sort" value="{{$project->sort}}"  />
                                    </div>
                                </div>

                                {{--<div class="control-group">--}}
                                    {{--<label class="control-label">联系人 :</label>--}}
                                    {{--<div class="controls">--}}
                                        {{--<input type="text" class="span11" name="contact" value="{{$project->contact}}"  />--}}
                                    {{--</div>--}}
                                {{--</div>--}}

                                <div class="control-group">
                                    <label class="control-label">电话 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="phone" value="{{$project->phone}}"  />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">联系人地址 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="address" value="{{$project->address}}"  />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">联系人Email :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="email" value="{{$project->email}}"  />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">邮编 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="postcode" value="{{$project->postcode}}"  />
                                    </div>
                                </div>
                              
                                <div class="control-group">
                                    <label class="control-label">融资金额 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="invest_fund" value="{{$project->invest_fund}}"  />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">投资前估值 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="invest_value" value="{{$project->invest_value}}"  />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">出让股份 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="transfer_share" value="{{$project->transfer_share}}"  />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>资金用途(多选) :</label>
                                    <div class="controls">
                                        <select data-placeholder="资金用途（多选）" class="chzn-select" name="plans[]" multiple style="width:600px;" tabindex="4" id="dl_chose1">
                                            @foreach($plans as $v)
                                                <option value="{{$v->id}}" @if(in_array($v->id,$plan_ids)) selected @endif>{{$v->name}}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">团队优势 :</label>
                                    <div class="controls">
                                        <textarea id="project_team_advantage" name="team_advantage" style="width: 450px; height: 240px;"><?php echo htmlspecialchars_decode($project->team_advantage); ?></textarea>                  
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">团队规模 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="team_size" value="{{$project->team_size}}"   />
                                    </div>
                                </div>
                              
                                <div class="control-group">
                                    <label class="control-label">项目评分 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="score" value="{{$project->score}}"   />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">项目月收入 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="month_income" value="{{$project->month_income}}"   />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">聊天群ID :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="groupid" value="{{$project->groupid}}"   />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">项目跟踪人 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="track_person" value="{{$project->track_person}}" placeholder="项目跟踪人"   />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">上传商业计划书 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="bp_name"
                                               placeholder="点击右边小图标上传商业计划书" readonly @if(is_object($bp)) value="{{$bp->filename}}" @endif />
                                        <input type="hidden" name="bp_filetype" @if(is_object($bp)) value="{{$bp->filetype}}" @endif>
                                        <input type="hidden" name="bp_filesize" @if(is_object($bp)) value="{{$bp->filesize}}" @endif>
                                        <input type="hidden" name="bp" @if(is_object($bp)) value="{{$bp->url}}" @endif>

                                        <a href="javascript:void(0);" id="uploadBpBtn"   onclick="javascript:openBrowse('uploadBpBtn','uploadBp');"><i class="icon-upload"></i></a>    <a id="del"><i class="icon-remove"></i></a>
                                        <input type="file" id="uploadBp" style="display:none" name="myfile" size="10" onchange="fileUpload('uploadBp','bp')"/>
                                    </div>
                                </div>

                                {{--<div class="control-group">--}}
                                    {{--<label class="control-label">商业计划书价格 :</label>--}}
                                    {{--<div class="controls">--}}
                                        {{--<input type="text" class="span11" name="bp_fileprize" placeholder="商业计划书价格" @if(is_object($bp)) value="{{$bp->fileprice}}" @endif/>--}}
                                    {{--</div>--}}
                                {{--</div>--}}

                                <div class="widget-title">
                                    <span class="icon"> <i class="icon-align-justify"></i></span>
                                    <h5>状态选项</h5>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">是否推荐 :</label>
                                    <div class="controls">
                                        <label> <input type="radio" name="recommend" value="1"    <?php if($project->recommend == 1) echo 'checked="checked"'; ?> /> 是
                                        </label> <label> <input type="radio" name="recommend" value="0"  <?php if($project->recommend == 0) echo 'checked="checked"'; ?> /> 否
                                        </label>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">是否热门 :</label>
                                    <div class="controls">
                                        <label> <input type="radio" name="hot" value="1" <?php if($project->hot == 1) echo 'checked="checked"'; ?> /> 是
                                        </label> <label> <input type="radio" name="hot" value="0" <?php if($project->hot == 0) echo 'checked="checked"'; ?> /> 否
                                        </label>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">是否置顶 :</label>
                                    <div class="controls">
                                        <label> <input type="radio" name="stick" value="1" <?php if($project->stick == 1) echo 'checked="checked"'; ?> /> 是
                                        </label> <label> <input type="radio" name="stick" value="0" <?php if($project->stick == 0) echo 'checked="checked"'; ?> /> 否
                                        </label>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">是否头条 :</label>
                                    <div class="controls">
                                        <label> <input type="radio" name="top" value="1" <?php if($project->top == 1) echo 'checked="checked"'; ?> /> 是
                                        </label> <label> <input type="radio" name="top" value="0" <?php if($project->top == 0) echo 'checked="checked"'; ?> /> 否
                                        </label>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">是否路演 :</label>
                                    <div class="controls">
                                        <label> <input type="radio" name="is_roadshow" value="1" <?php if($project->is_roadshow == 1) echo 'checked="checked"'; ?> /> 是
                                        </label> <label> <input type="radio" name="is_roadshow" value="0" <?php if($project->is_roadshow == 0) echo 'checked="checked"'; ?> /> 否
                                        </label>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">是否向投资人公开 :</label>
                                    <div class="controls">
                                        <label> <input type="radio" name="open_to_investor" value="1"  @if($project->open_to_investor == 1) checked="checked"@endif /> 是
                                        </label> <label> <input type="radio" name="open_to_investor" value="0" @if($project->open_to_investor == 0) checked="checked"@endif /> 否
                                        </label>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">状态 :</label>
                                    <div class="controls">
                                        <label> <input type="radio" name="status" value="1" <?php if($project->status == 1) echo 'checked="checked"'; ?> /> 审核通过
                                        </label> <label> <input type="radio" name="status" value="0" <?php if($project->status == 0) echo 'checked="checked"'; ?> /> 审核中
                                        </label> <label> <input type="radio" name="status" value="2" <?php if($project->status == 2) echo 'checked="checked"'; ?> /> 审核不通过
                                        </label> <label> <input type="radio" name="status" value="-1" <?php if($project->status == -1) echo 'checked="checked"'; ?> /> 禁用
                                        </label> <label> <input type="radio" name="status" value="3" <?php if($project->status == 3) echo 'checked="checked"'; ?> /> 完成融资
                                        </label>
                                    </div>
                                </div>


                                <div class="control-group">
                                    <label class="control-label">备注 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="remark" placeholder="审核不通过或禁用的备注" value="{{$project->remark}}"  />
                                    </div>
                                </div>


                                <div class="control-group">
                                    <label class="control-label">是否明星项目 :</label>
                                    <div class="controls">
                                        <label> <input type="radio" name="star" value="1" <?php if($project->star == 1) echo 'checked="checked"'; ?> /> 是
                                        </label> <label> <input type="radio" name="star" value="0" <?php if($project->star == 0) echo 'checked="checked"'; ?> /> 否
                                        </label>
                                    </div>
                                </div>
    
                                {{--@endif--}}
                                <div class="form-actions">
                                    <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                    <button type="button" class="btn btn-success" id="doSave">确认修改</button>
                                </div>
                            </form>
                        </div>
                        @include('message.flash')
                        @include('errors.list')
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        $(document).ready(function(){
            //初始化
            $(".chzn-select").chosen();

        });

        $("#del").click(function(){
            var param = {};
            param['bp_name'] = $("input[name=bp_name]").val();
            param['id'] = $("input[name=id]").val();

            ajaxRequest(param, '/project/delete-file', function (data) {
                $("input[name=bp_name]").prop('value','点击右边小图标上传商业计划书');
                alert(data.message);
            });
        })

        $("#type").change(function() {
            var val = $(this).val();
            if('newthree' == val){
                $('#newthree_period').show();
                $('#out').show();
                $('#newthree_invest_way').show();
                $('#invest_way').hide();
                $('#project_period').hide();
            }else{
                $('#newthree_period').hide();
                $('#out').hide();
                $('#newthree_invest_way').hide();
                $('#invest_way').show();
                $('#project_period').show();
            }

        });


        $("input[name='user_search']").keydown(function(event) {
            if (event.which == "13"){
                var param = {};
                param['user_search'] = $(this).val();
                ajaxRequest(param, '/project/user-search', function (data) {
                    if (data.status) {
                        var html = '<option value="">请选择</option>';
                        $.each(data.message, function (i, n) {
                            if(n.realname){
                                html += "<option value='" + n.uid + "'>" + n.realname + "</option>";
                            }else{
                                html += "<option value='" + n.uid + "'>" + n.nickname + "</option>";
                            }
                        });
                        $("#uid").html(html);
                        alert('恭喜，已经生成选项,请选择所需要的用户');
                    } else {
//                        var html = '<option value="">请按上面输入框的说明生成选项</option>';
//                        $("#post_id").html(html);
                        alert(data.message);
                    }
                });
            }
        });

        $("#doSave").click(function(){
            var project_content = $("#project_content").html();
            $("input[name='content']").val(project_content);
            ajaxRequest($('#projectForm').serializeArray(),$('#projectForm').attr('action'),function(data){
                if(data.status){
                    alert(data.message);
                    window.location.href = data.forwardUrl;
                }else{
                    alert(data.message);
                }
            });
        });

        $("#city").change(function() {
            $("#zone").empty();
            $.post("{{url('zone/children')}}", {
                id: $(this).val()
            }, function(data) {
                if (data.status) {
                    var html = '<option value="0">城市</option>';
                    $.each(data.message, function(i, n) {
                        html += "<option value='"+n.id+"'>"+n.name+"</option>";
                    });
                    $("#zone").html(html);
                }
            }, 'json');
        });   

    </script>
@stop
